package com.example.zhang;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class rate_cal extends AppCompatActivity {
    float rate = 0f;
    float x = 0f;
    String TAG ="e";
    EditText input;
    TextView out;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rate_cal);
        String title = getIntent().getStringExtra("title");
        rate = getIntent().getFloatExtra("rate",0f);
        input = findViewById(R.id.input1);
        out = findViewById(R.id.out1);


        Log.i(TAG, "onCreate: title="+title);
        Log.i(TAG, "onCreate: rate="+rate);

        ((TextView)findViewById(R.id.name1)).setText(title);
        ((TextView)findViewById(R.id.rate1)).setText(String.valueOf(rate));


    }

    private void show() {
        out.setText(String.valueOf(x));
    }

    public void btn(View v) {
        x=Float.parseFloat(input.getText().toString());
        x=x*rate;
        show();
    }
}